using pixolut.BizBlox;
using System;

public class LunchOrderCollection : DOCollection
{

//START BizBlox Generated Code : Do not remove or alter this comment
//Last Updated : Thursday, 24 August 2006 4:57:09 PM
//BizBlox Version : 1.2.0.0
#region "BizBlox Generated Code"

    public LunchOrderCollection() : base(new DOFactory((DataObject)new LunchOrder())) {
    }

    //to typecast your item() property
    public new LunchOrder this[int i]{
        get{
            return (LunchOrder)base[i];
        }
    }

#endregion
//END BizBlox Generated Code : Do not remove or alter this comment

	public void FindByFood( Guid FoodID ) 
	{ 
		SQLBuilder mySql = base.GetSqlBuilder(); 
		mySql.addWhere( LunchOrder.Columns.FoodID, FoodID.ToString() );
        base.SetCurrentQuery(mySql);
		base.Find(); 
	} 

        
	public void FindByEmailAndPrice( string email, double priceLower, double priceUpper ) 
	{ 
		SQLBuilder mySql = base.GetSqlBuilder(); 
		mySql.addInnerJoin( LunchOrder.Columns.FoodID, new Food(), Food.Columns.FoodID ); 
		mySql.addInnerJoin( LunchOrder.Columns.StudentID, new Student(), Student.Columns.StudentID ); 
		if ( email != "" ) 
		{ 
			SearchBuilder sbEmail = new SearchBuilder( email ); 
			mySql.addSearch( new Student(), Student.Columns.Email, sbEmail ); 
			mySql.addAnd(); 
		} 
		mySql.AddWhereGTE( new Food(), Food.Columns.Price, priceLower.ToString() ); 
		mySql.addAnd(); 
		mySql.AddWhereLTE( new Food(), Food.Columns.Price, priceUpper.ToString() );
        base.SetCurrentQuery(mySql);
		base.Find(); 
	}        
                

}